package  
{
	import flash.display.BitmapData;
	import net.flashpunk.Entity;
	import net.flashpunk.FP;
	import net.flashpunk.graphics.Emitter;
	import net.flashpunk.graphics.Spritemap;
	import net.flashpunk.utils.Input;
	import net.flashpunk.utils.Key;
	
	/**
	 * ...
	 * @author Edward Russell II
	 */
	public class swordGuy extends Entity 
	{
		[Embed(source = "../assets/swordguy.png")] private var swordguy:Class;
		public var sprSwordGuy:Spritemap = new Spritemap(swordguy, 48, 32);
		

		
		public function swordGuy() 
		{
			sprSwordGuy.add("stand", [0, 1, 2, 3, 4, 5], 20)
			sprSwordGuy.add("run", [6, 7, 8, 9, 10, 11], 20)
			
			type = "player";
			graphic = sprSwordGuy;
			sprSwordGuy.scale = 4
			setHitbox(sprSwordGuy.scaledWidth, sprSwordGuy.scaledHeight);
			x = FP.screen.width / 2;
			y = FP.screen.height - sprSwordGuy.scaledHeight;
		}
		
		override public function update():void 
		{
			if (Input.check(Key.LEFT)) 
			{
				x -= GC.PLAYER_SPEED * FP.elapsed;
				sprSwordGuy.flipped = true;
				sprSwordGuy.play("run");
			}
			else if (Input.check(Key.RIGHT)) 
			{
				x += GC.PLAYER_SPEED * FP.elapsed;
				sprSwordGuy.flipped = false;
				sprSwordGuy.play("run");
			}
			else
			{
				sprSwordGuy.play("stand");
			}
			
			
			super.update();
		}
		
	}

}